package ch.abcm.remsmobile.REMSMobile;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import ch.abcm.remsmobile.REMSMobile.history.MessageHistoryActivity;
import ch.abcm.remsmobile.REMSMobile.preferences.PrefsActivity;

public class REMSMainActivity extends Activity {

	private static final String TAG = "REMSMainActivity";
	

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		Intent startIntent = new Intent(StartupJob.START_UP);
		sendBroadcast(startIntent);
//		new REMSMulticastController().startMulticastReceiver(new REMSMulticastReceiver(this));
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(ch.abcm.remsmobile.REMSMobile.R.menu.main, menu);
		return true;
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case R.id.action_settings:
			Log.d(TAG, "Button clicked");
			Intent prefIntent = new Intent(this, PrefsActivity.class);
			startActivity(prefIntent);
			break;
		}
		return true;
	}
	
	public void onButtonClick(View view) {
		Intent intent = new Intent(this, MessageHistoryActivity.class);
		startActivity(intent);
	}
	
}
